home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 September / PCWorld_2008-09_cd.bin / v cisle / sadanastroju / bookmark_previews-0.6.5-fx.xpi / chrome / content / placestreeview.js < prev    next >
Text File  |  2008-05-27  |  4KB  |  110 lines

  1. function extendPreviewView(view,tree){
  2.   view._treeType = tree;
  3.   for (var p in PlacesPreviewTreeView.prototype){
  4.     if (p in view){
  5.       view[("_"+p)] = view[p];
  6.       view[p] = PlacesPreviewTreeView.prototype[p];
  7.     } else {
  8.       view[p] = PlacesPreviewTreeView.prototype[p];
  9.     }
  10.   }
  11. }
  12. function PlacesPreviewTreeView(view,tree) {
  13.   //dump("new places tree view\n");
  14.   this._treeType = tree;
  15.   this._view = view;
  16. }
  17. PlacesPreviewTreeView.prototype = {
  18.   itemInserted: function(parent, item, newIndex) {
  19.     if (PlacesPreviewUtils.loading) return;
  20.     this.___LOG("item inserted: "+item.title);
  21.     this.lastItem = item.itemId;
  22.     if (this._itemInserted)
  23.       this._itemInserted.apply(this,arguments);
  24.     PlacesPreviewUtils.utils.refreshDisplay(true);
  25.     if (PlacesPreviewUtils.selected == "thumbnails"){
  26.       /* select inserted item */
  27.       ThumbView.selectNode(item);
  28.     }
  29.   },
  30.   itemRemoved: function(parent, item, oldIndex) {
  31.     if (PlacesPreviewUtils.loading) return;
  32.     this.___LOG("item removed: "+item.title);
  33.     this.lastItem = item.itemId;
  34.     if (this._itemRemoved)
  35.       this._itemRemoved.apply(this,arguments);
  36.     PlacesPreviewUtils.utils.refreshDisplay(true);
  37.   },
  38.   itemChanged: function(item) {
  39.     if (PlacesPreviewUtils.loading) return;
  40.     this.___LOG("item changed: "+item.title);
  41.     if (this._itemChanged)
  42.       this._itemChanged.apply(this,arguments);
  43.   },
  44.   itemReplaced: function(parent, oldItem, newItem, index) {
  45.     if (PlacesPreviewUtils.loading) return;
  46.     this.___LOG("itemReplaced: " + newItem.uri);
  47.     this.lastItem = item.itemId;
  48.     if (this._itemReplaced)
  49.       this._itemReplaced.apply(this,arguments);
  50.     PlacesPreviewUtils.utils.refreshDisplay(true);
  51.   },
  52.   itemMoved: function(item, oldParent, oldIndex, newParent, newIndex) {
  53.     if (PlacesPreviewUtils.loading) return;
  54.     this.___LOG("item moved\n");
  55.     this.lastItem = item.itemId;
  56.     if (this._itemMoved)
  57.       this._itemMoved.apply(this,arguments);
  58.     PlacesPreviewUtils.utils.refreshDisplay(true);
  59.   },
  60.   containerOpened: function(item) {
  61.     if (PlacesPreviewUtils.loading) return;
  62.     this.___LOG("container opened: "+item.title);
  63.     //dump("called: "+arguments.callee.caller.caller+"\n");
  64.     if (this._containerOpened)
  65.       this._containerOpened.apply(this,arguments);
  66.     if (!PlacesPreviewUtils.utils.updatedSelection){
  67.       setTimeout(function PPTV_containerOpen(){
  68.         if (PlacesPreviewUtils.utils)
  69.           PlacesPreviewUtils.utils.refreshDisplay(true);
  70.       },0);
  71.     }
  72.   },
  73.   containerClosed: function(item) {
  74.     if (PlacesPreviewUtils.loading) return;
  75.     this.___LOG("container closed: "+item.title);
  76.     if (this._containerClosed)
  77.       this._containerClosed.apply(this,arguments);
  78.   },
  79.   invalidateContainer: function(item) {
  80.     if (PlacesPreviewUtils.loading) return;
  81.     this.___LOG("invalidateContainer(): "+item.title);
  82.     if (this._invalidateContainer)
  83.       this._invalidateContainer.apply(this,arguments);
  84.   },
  85.   invalidateAll: function() {
  86.     if (PlacesPreviewUtils.loading) return;
  87.     this.___LOG("invalidateAll\n");
  88.     if (this._invalidateAll)
  89.       this._invalidateAll.apply(this,arguments);
  90.     setTimeout(function(){
  91.       PlacesPreviewUtils.utils.refreshDisplay(true);
  92.     },0);
  93.   },
  94.   //sortingChanged: function(sortingMode) {
  95.   //  //dump("tree: "+this._treeType+" - "+"sorting changed: "+sortingMode+"\n");
  96.   //  this._sortingChanged.apply(this,arguments);
  97.   //}
  98.   ___LOG : function(aText){
  99.     dump("tree: "+this._treeType+" - "+aText+"\n");
  100.   }
  101. };
  102.  
  103. function PlacesThumbView(aShowRow, aFlatList){
  104.  
  105. }
  106. PlacesThumbView.prototype = {
  107.   addViewObserver: function(observer, ownsWeak) {},
  108.   removeViewObserver: function(observer) {}
  109. };
  110.